vec3 gradient( sampler3D data, const float scaleValue, const vec4 texCoord, const float voxelSpacing )
{
      vec3 delX = vec3(voxelSpacing, 0.0, 0.0);
      vec3 delY = vec3(0.0, voxelSpacing, 0.0);
      vec3 delZ = vec3(0.0, 0.0, voxelSpacing);
      //
      // Sample the texture
      //
      vec4 cx = texture3D( data, vec3(texCoord[0])+delX );
      vec4 cy = texture3D( data, vec3(texCoord[0])+delY );
      vec4 cz = texture3D( data, vec3(texCoord[0])+delZ );
      //
      // For central differences, we need three more samples.
      //
      vec4 cmx = texture3D( data, vec3(texCoord[0])-delX );
      vec4 cmy = texture3D( data, vec3(texCoord[0])-delY );
      vec4 cmz = texture3D( data, vec3(texCoord[0])-delZ );
      //
      // Calculate the gradient vector at the sample position.
      // 	
      vec3 grad;
      grad.x = cx.a-cmx.a;
      grad.y = cy.a-cmy.a;
      grad.z = cz.a-cmz.a;
      return normalize( grad );
} 